# -*- coding: utf-8 -*-

# @Time : 2020/2/7 15:58
# @Author : WYT
# @Site :
# @File : hzflow.py
# @Software: PyCharm

from sqlalchemy import MetaData, Table, create_engine
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base


from settings import online_config as flow

engine = create_engine(f"mysql+mysqlconnector://{flow.get('user')}:{flow.get('password')}@{flow.get('host')}:"
                       f"{flow.get('port')}/hzflow?charset={flow.get('charset')}")


Base = declarative_base(engine)
md = MetaData(bind=engine)

# # # 加载 总表 使 session 可以对这个表进行操作
# class tblind(Base):
#     __table__ = Table('tblind', md, autoload=True)


class domain(Base):
    __table__ = Table("domain", md, autoload=True)


class ent_flow_data(Base):
    __table__ = Table('ent_flow_data', md, autoload=True)


class ent_flow_datalog(Base):
    __table__ = Table("ent_flow_datalog", md, autoload=True)

class ent_error_info(Base):
    __table__ = Table('ent_error_info', md, autoload=True)


class ent_records_status(Base):
    __table__ = Table('ent_records_status', md, autoload=True)


class ent_datasync_reason(Base):
    __table__ = Table("ent_datasync_reason", md, autoload=True)


# class ent_email_record(Base):
#     __table__ = Table("ent_email_record", md, autoload=True)


class ent_note_record(Base):
    __table__ = Table("ent_note_record", md, autoload=True)


Base.metadata.create_all()

# # # 创建 session 会话
Session = sessionmaker(bind=engine)
session = Session()


if __name__ == '__main__':

    print(dir(ent_flow_data))








